#include "LocalScene.h"
#include "Utils/LogUtil.h"
#include "LocalEntity.h"
#include "Utils/StringUtil.h"
#include "Render/RenderState.h"
#include "Render/Imgui/imgui.h"
#include "Math/Random.h"
#include "Game/GameState.h"
#include "VoxelProcess.h"
#include "Game/Component/SceneModel.h"
#include "TracerProcess.h"


void LocalScene::OnInit()
{
	mCamera.SetSpeed(0.2f);
	mCamera.SetPosition(glm::vec3(1.377675f, 1.473249f, 1.478754f));
	mCamera.UpdateViewMatrix();

#if NOT_TEST_LOCAL
	mTracerProcess = GetProcess<TracerProcess>("TracerProcess");
#endif

	mCoordinateProcess = GetProcess<CoordinateProcess>("CoordinateProcess");

	mOctreeLevel = 10;

	LocalEntity* sceneEntity = CreateEntity<LocalEntity>("scene");
	sceneEntity->AddComponent<SceneModel>("SponzaFull.obj");
	sceneEntity->GetTransform().SetLocalScale(glm::vec3(10.f));
	sceneEntity->GetTransform().UpdateMatrices();
}

void LocalScene::OnTick(float deltaTime)
{
}

void LocalScene::OnImgui()
{
	if (ImGui::BeginMainMenuBar())
	{
		ImGui::Text("Fps : %d ", GRenderState->GetFps());

#if NOT_TEST_LOCAL
		ImGui::Checkbox("Enable Beam", &mTracerProcess->mBeamEnable);
		ImGui::RadioButton("Result", &mTracerProcess->mViewType, 0);
		ImGui::RadioButton("Normal", &mTracerProcess->mViewType, 1);
		ImGui::RadioButton("Position", &mTracerProcess->mViewType, 2);
		ImGui::RadioButton("Heat", &mTracerProcess->mViewType, 3);
		ImGui::RadioButton("Beam", &mTracerProcess->mViewType, 4);
		ImGui::RadioButton("Direction", &mTracerProcess->mViewType, 5);
#endif

		ImGui::EndMainMenuBar();
	}


}

void LocalScene::OnExit()
{

}